import numpy as np
import torch
import pandas as pd
import matplotlib.pyplot as plt
import torchvision
import warnings
import datetime
warnings.filterwarnings("ignore")


features = pd.read_csv('temps.csv')
year = features['year']
month = features['month']
day = features['day']

# datetime  格式
dates = [str(year[i]) + '-' + str(month[i]) + '-' + str(day[i]) for i in range(len(year))]
dates  = [datetime.datetime.strptime(date, '%Y-%m-%d') for date in dates]

#  画图
plt.style.use('fivethirtyeight')
# 设置布局
fig,((ax1,ax2),(ax3,ax4)) = plt.subplots(2,2,figsize=(10,10))
fig.autofmt_xdate(rotation=45)
# 标签值
ax1.plot(dates,features['actual'])
ax1.set_xlabel('');ax1.set_ylabel('Temperature');ax1.set_title('Max Temp')
# 昨天
ax2.plot(dates,features['temp_1'])
ax2.set_xlabel('');ax2.set_ylabel('Temperature'); ax2.set_title('Previous Max Temp')
# 前天
ax3.plot(dates,features['temp_2'])
ax3.set_xlabel('');ax3.set_ylabel('Temperature'); ax3.set_title('Previous Max Temp')
# friend
ax4.plot(dates,features['friend'])
ax4.set_xlabel('');ax4.set_ylabel('Temperature'); ax4.set_title('Friends Temp')
plt.tight_layout(pad=2)
plt.show()
